package cn.tedu.spring.di;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

/**
 * 1.Controller:控制器层,用于接收请求并返回响应;
 * 2.Service:业务层,用于处理业务逻辑;
 * 3.Repository:数据访问层,用于访问数据库;
 * 4.Component:通用注解,用于标记Bean对象;
 */

@Component
//@Controller
//@Service
//@Repository
public class UserDao {
    /*
        Value注解：
          1.依赖注入注解[创建Bean对象过程中给属性赋值];
          2.基本类型数据注入;
     */
    @Value("jdbc:mysql://localhost:3306/tedu")
    private String dbUrl;
    @Value("root")
    private String username;
    @Value("root")
    private String password;

    @Override
    public String toString() {
        return "UserDao{" +
                "dbUrl='" + dbUrl + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
